package com.huawei.spare.part.replace.models;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.google.common.collect.Lists;
import com.huawei.spare.part.replace.models.constants.Plane;
import lombok.Data;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.List;


/**
 * 软件安装包，从Excel中匹配加载
 */
@Data
@ToString
public class InstallPackage implements Serializable {

    //    单板类型	交换平面	是否V5	交换软件版本号	CPLD版本号
    @Excel(name = "单板类型", isImportField = "true")
    String boardTypes;

    @Excel(name = "交换平面", isImportField = "true")
    Plane plane;

    @Excel(name = "是否V5", isImportField = "true", replace = {"Yes_true", "No_false"})
    Boolean isV5;

    @Excel(name = "交换软件版本号", isImportField = "true")
    String softwareVersion;

    @Excel(name = "CPLD版本号", isImportField = "true")
    String cpldVersion;

    //BMC版本号	版本目录名	是否受限	软件包名	下载路径

    @Excel(name = "BMC版本号", isImportField = "true")
    String bmcVersion;

    @Excel(name = "版本目录名", isImportField = "true")
    String packageFolderName;

    @Excel(name = "是否受限", isImportField = "true", replace = {"Yes_true", "No_false"})
    Boolean isLimit = true;

    @Excel(name = "软件包名", isImportField = "true")
    String packageName;

    @Excel(name = "下载路径", isImportField = "true")
    String downloadUrl;


    public List<String> getBoardTypes() {
        if (StringUtils.isNoneBlank(boardTypes)) {
            return Lists.newArrayList(boardTypes.split("/"));
        }
        return Lists.newArrayList();
    }


}
